import matplotlib.pyplot as plt

fig, ax = plt.subplots()

# 获取x轴的主要刻度定位器
x_major_locator = ax.xaxis.get_major_locator()

# 获取y轴的次要刻度定位器
y_minor_locator = ax.yaxis.get_minor_locator()

# 获取x轴的主要刻度格式化器
x_major_formatter = ax.xaxis.get_major_formatter()

# 获取y轴的次要刻度格式化器
y_minor_formatter = ax.yaxis.get_minor_formatter()

print(x_major_locator, y_minor_locator, x_major_formatter, y_minor_formatter)
